package com.dmjj.limit.service.impl;

import com.dmjj.common.base.BaseMapper;
import com.dmjj.common.base.BaseServiceImpl;
import com.dmjj.limit.dao.DataAuthMapper;
import com.dmjj.limit.dto.DataAuthDTO;
import com.dmjj.limit.service.DataAuthService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.stereotype.Service;
import java.util.List;


/**
 * 数据范围授权表业务处理接口
 * @Author zhangxue
 * @Date 2019-03-23 15:00:15
 */
@Service
public class DataAuthServiceImpl extends BaseServiceImpl<DataAuthDTO, Long> implements DataAuthService {

    private static final Log LOGGER = LogFactory.getLog(DataAuthServiceImpl.class);

    @Autowired
    private DataAuthMapper mapper;

    @Override
    protected BaseMapper<DataAuthDTO, Long> getMapper() {
        return mapper;
    }

    /**
     * 数据范围授权表列表
     * @Author zhangxue
     * @Date 2019-03-23 15:00:15
     * @Param
     * @Return
     */
    @Override
    public List<DataAuthDTO> list4Page(DataAuthDTO entity, Integer pageNum, Integer... pageSize) {
        return super.list4Page(entity, pageNum, pageSize);
    }

    /**
     * 数据范围授权表列表（无分页）
     * @Author zhangxue
     * @Date 2019-03-23 15:00:15
     * @Param
     * @Return
     */
    @Override
    public List<DataAuthDTO> listByCondition(DataAuthDTO entity) {
        return super.listByCondition(entity);
    }

    /**
     * 查询数据范围授权表详情信息
     * @Author zhangxue
     * @Date 2019-03-23 15:00:15
     * @Param
     * @Return
     */
    @Override
    public DataAuthDTO queryOneByPk(Long id) {
        return super.queryOneByPk(id);
    }

    /**
     * 保存数据范围授权表信息
     * @Author zhangxue
     * @Date 2019-03-23 15:00:15
     * @Param
     * @Return
     */
    @Override
    @Transactional
    public Long save(DataAuthDTO entity) {
        return super.save(entity);
    }

    /**
     * 删除数据范围授权表信息
     * @Author zhangxue
     * @Date 2019-03-23 15:00:15
     * @Param
     * @Return
     */
    @Override
    @Transactional
    public Integer delete(Long id) {
        return super.delete(id);
    }

    /**
     * 查询用户是否已经授权权限范围
     * @Author zhangxue
     * @Date 2019-03-21 09:40:56
     * @Param
     * @Return
     */
    @Override
    public List<DataAuthDTO> queryDataAuthIsExist(String userno) {
        return mapper.queryDataAuthIsExist(userno);
    }
}
